\(\int \frac {(a+b x^2)^2}{x^2 (c+d x^2)} \, dx\) [174]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 55 \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=-\frac {a^2}{c x}+\frac {b^2 x}{d}-\frac {(b c-a d)^2 \arctan \left (\frac {\sqrt {d} x}{\sqrt {c}}\right )}{c^{3/2} d^{3/2}} \]

[Out]

-a^2/c/x+b^2*x/d-(-a*d+b*c)^2*arctan(x*d^(1/2)/c^(1/2))/c^(3/2)/d^(3/2)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {472, 211} \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=-\frac {a^2}{c x}-\frac {(b c-a d)^2 \arctan \left (\frac {\sqrt {d} x}{\sqrt {c}}\right )}{c^{3/2} d^{3/2}}+\frac {b^2 x}{d} \]

[In]

Int[(a + b*x^2)^2/(x^2*(c + d*x^2)),x]

[Out]

-(a^2/(c*x)) + (b^2*x)/d - ((b*c - a*d)^2*ArcTan[(Sqrt[d]*x)/Sqrt[c]])/(c^(3/2)*d^(3/2))

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 472

Int[(((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_))/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Int[ExpandIntegr
and[(e*x)^m*((a + b*x^n)^p/(c + d*x^n)), x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[n
, 0] && IGtQ[p, 0] && (IntegerQ[m] || IGtQ[2*(m + 1), 0] ||  !RationalQ[m])

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {b^2}{d}+\frac {a^2}{c x^2}-\frac {(b c-a d)^2}{c d \left (c+d x^2\right )}\right ) \, dx \\ & = -\frac {a^2}{c x}+\frac {b^2 x}{d}-\frac {(b c-a d)^2 \int \frac {1}{c+d x^2} \, dx}{c d} \\ & = -\frac {a^2}{c x}+\frac {b^2 x}{d}-\frac {(b c-a d)^2 \tan ^{-1}\left (\frac {\sqrt {d} x}{\sqrt {c}}\right )}{c^{3/2} d^{3/2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.00 \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=-\frac {a^2}{c x}+\frac {b^2 x}{d}-\frac {(b c-a d)^2 \arctan \left (\frac {\sqrt {d} x}{\sqrt {c}}\right )}{c^{3/2} d^{3/2}} \]

[In]

Integrate[(a + b*x^2)^2/(x^2*(c + d*x^2)),x]

[Out]

-(a^2/(c*x)) + (b^2*x)/d - ((b*c - a*d)^2*ArcTan[(Sqrt[d]*x)/Sqrt[c]])/(c^(3/2)*d^(3/2))

Maple [A] (verified)

Time = 2.62 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.18

method result size
default \(\frac {b^{2} x}{d}+\frac {\left (-a^{2} d^{2}+2 a b c d -b^{2} c^{2}\right ) \arctan \left (\frac {d x}{\sqrt {c d}}\right )}{c d \sqrt {c d}}-\frac {a^{2}}{c x}\) \(65\)
risch \(\frac {b^{2} x}{d}-\frac {a^{2}}{c x}+\frac {\munderset {\textit {\_R} =\operatorname {RootOf}\left (a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,b^{3} c^{3} d +b^{4} c^{4}+c^{3} d \,\textit {\_Z}^{2}\right )}{\sum }\textit {\_R} \ln \left (\left (2 a^{4} d^{4}-8 a^{3} b c \,d^{3}+12 a^{2} b^{2} c^{2} d^{2}-8 a \,b^{3} c^{3} d +2 b^{4} c^{4}+3 \textit {\_R}^{2} c^{3} d \right ) x +\left (a^{2} c^{2} d^{2}-2 a b \,c^{3} d +b^{2} c^{4}\right ) \textit {\_R} \right )}{2 d}\) \(181\)

[In]

int((b*x^2+a)^2/x^2/(d*x^2+c),x,method=_RETURNVERBOSE)

[Out]

b^2*x/d+1/c/d*(-a^2*d^2+2*a*b*c*d-b^2*c^2)/(c*d)^(1/2)*arctan(d*x/(c*d)^(1/2))-a^2/c/x

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 164, normalized size of antiderivative = 2.98 \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=\left [\frac {2 \, b^{2} c^{2} d x^{2} - 2 \, a^{2} c d^{2} - {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {-c d} x \log \left (\frac {d x^{2} + 2 \, \sqrt {-c d} x - c}{d x^{2} + c}\right )}{2 \, c^{2} d^{2} x}, \frac {b^{2} c^{2} d x^{2} - a^{2} c d^{2} - {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {c d} x \arctan \left (\frac {\sqrt {c d} x}{c}\right )}{c^{2} d^{2} x}\right ] \]

[In]

integrate((b*x^2+a)^2/x^2/(d*x^2+c),x, algorithm="fricas")

[Out]

[1/2*(2*b^2*c^2*d*x^2 - 2*a^2*c*d^2 - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*sqrt(-c*d)*x*log((d*x^2 + 2*sqrt(-c*d)*x
 - c)/(d*x^2 + c)))/(c^2*d^2*x), (b^2*c^2*d*x^2 - a^2*c*d^2 - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*sqrt(c*d)*x*arct
an(sqrt(c*d)*x/c))/(c^2*d^2*x)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 165 vs. \(2 (44) = 88\).

Time = 0.29 (sec) , antiderivative size = 165, normalized size of antiderivative = 3.00 \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=- \frac {a^{2}}{c x} + \frac {b^{2} x}{d} + \frac {\sqrt {- \frac {1}{c^{3} d^{3}}} \left (a d - b c\right )^{2} \log {\left (- \frac {c^{2} d \sqrt {- \frac {1}{c^{3} d^{3}}} \left (a d - b c\right )^{2}}{a^{2} d^{2} - 2 a b c d + b^{2} c^{2}} + x \right )}}{2} - \frac {\sqrt {- \frac {1}{c^{3} d^{3}}} \left (a d - b c\right )^{2} \log {\left (\frac {c^{2} d \sqrt {- \frac {1}{c^{3} d^{3}}} \left (a d - b c\right )^{2}}{a^{2} d^{2} - 2 a b c d + b^{2} c^{2}} + x \right )}}{2} \]

[In]

integrate((b*x**2+a)**2/x**2/(d*x**2+c),x)

[Out]

-a**2/(c*x) + b**2*x/d + sqrt(-1/(c**3*d**3))*(a*d - b*c)**2*log(-c**2*d*sqrt(-1/(c**3*d**3))*(a*d - b*c)**2/(
a**2*d**2 - 2*a*b*c*d + b**2*c**2) + x)/2 - sqrt(-1/(c**3*d**3))*(a*d - b*c)**2*log(c**2*d*sqrt(-1/(c**3*d**3)
)*(a*d - b*c)**2/(a**2*d**2 - 2*a*b*c*d + b**2*c**2) + x)/2

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.15 \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=\frac {b^{2} x}{d} - \frac {a^{2}}{c x} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \arctan \left (\frac {d x}{\sqrt {c d}}\right )}{\sqrt {c d} c d} \]

[In]

integrate((b*x^2+a)^2/x^2/(d*x^2+c),x, algorithm="maxima")

[Out]

b^2*x/d - a^2/(c*x) - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*arctan(d*x/sqrt(c*d))/(sqrt(c*d)*c*d)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.15 \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=\frac {b^{2} x}{d} - \frac {a^{2}}{c x} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \arctan \left (\frac {d x}{\sqrt {c d}}\right )}{\sqrt {c d} c d} \]

[In]

integrate((b*x^2+a)^2/x^2/(d*x^2+c),x, algorithm="giac")

[Out]

b^2*x/d - a^2/(c*x) - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*arctan(d*x/sqrt(c*d))/(sqrt(c*d)*c*d)

Mupad [B] (verification not implemented)

Time = 5.00 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.45 \[ \int \frac {\left (a+b x^2\right )^2}{x^2 \left (c+d x^2\right )} \, dx=\frac {b^2\,x}{d}-\frac {a^2}{c\,x}-\frac {\mathrm {atan}\left (\frac {\sqrt {d}\,x\,{\left (a\,d-b\,c\right )}^2}{\sqrt {c}\,\left (a^2\,d^2-2\,a\,b\,c\,d+b^2\,c^2\right )}\right )\,{\left (a\,d-b\,c\right )}^2}{c^{3/2}\,d^{3/2}} \]

[In]

int((a + b*x^2)^2/(x^2*(c + d*x^2)),x)

[Out]

(b^2*x)/d - a^2/(c*x) - (atan((d^(1/2)*x*(a*d - b*c)^2)/(c^(1/2)*(a^2*d^2 + b^2*c^2 - 2*a*b*c*d)))*(a*d - b*c)
^2)/(c^(3/2)*d^(3/2))